using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Presentation.Contracts;
using Presentation;
using System.Collections.Generic;
using DataAccess;


namespace ProjektZespolowy
{
    public partial class Default : Page, IDefaultView
    {
        private DefaultPresenter presenter;

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            presenter = new DefaultPresenter(this);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            presenter.FillPage();
        }

        public void DisplayLastArt(List<art> listOfArts)
        {
            repLastArt.DataSource = listOfArts;
            repLastArt.DataBind();
        }

        public void DisplayBestArt(IList listOfArts)
        {
            repBestArt.DataSource = listOfArts;
            repBestArt.DataBind();
        }

        public void DisplayLastUsers(IList<user> listOfUser)
        {
            repLastUsers.DataSource = listOfUser;
            repLastUsers.DataBind();
        }

		public void DisplayLastActiveForums(List<forum> listOfForums)
			{
			repActiveForums.DataSource = listOfForums;
			repActiveForums.DataBind();
			}


        public string GetMiniFoto(string bigFoto)
        {
            if (string.IsNullOrEmpty(bigFoto))
                return "";
            string extension = System.IO.Path.GetExtension(bigFoto);
            bigFoto = bigFoto.Replace(extension, string.Empty);
            return bigFoto + "_mini" + extension;
        }



        public string GetAvatar(user u)
        {

            return u.avatar_mime == null ? "/images/blank-photo.gif" : "/GetUserPicture.aspx?id=" + u.id.ToString();

        }




    }
}
